//
//  UIView+JPF.h
//  JPFCore
//
//  Created by JPFei on 2019/3/8.
//  Copyright © 2019 nmo. All rights reserved.
//

#import <UIKit/UIKit.h>

NS_ASSUME_NONNULL_BEGIN

@interface UIView (JPF)


/**  起点x坐标  */
@property (nonatomic, assign) CGFloat x;
/**  起点y坐标  */
@property (nonatomic, assign) CGFloat y;
/**  中心点x坐标  */
@property (nonatomic, assign) CGFloat centerX;
/**  中心点y坐标  */
@property (nonatomic, assign) CGFloat centerY;
/**  宽度  */
@property (nonatomic, assign) CGFloat width;
/**  高度  */
@property (nonatomic, assign) CGFloat height;
/**  顶部  */
@property (nonatomic, assign) CGFloat top;
/**  底部  */
@property (nonatomic, assign) CGFloat bottom;
/**  左边  */
@property (nonatomic, assign) CGFloat left;
/**  右边  */
@property (nonatomic, assign) CGFloat right;
/**  size  */
@property (nonatomic, assign) CGSize size;
/**  origin */
@property (nonatomic, assign) CGPoint origin;

- (void)removeAllSubViews;

/**  设置圆角  */
- (void)setCornerRadius:(CGFloat)cornerRadius;

/**  设置边框  */
- (void)setBorderColor:(UIColor*)borderColor
                 width:(CGFloat)borderWidth;

/**   给哪几个角设置圆角  */
- (void)round:(CGFloat)cornerRadius RectCorners:(UIRectCorner)rectCorner;

/**  设置阴影  */
- (void)shadow:(UIColor *)shadowColor opacity:(CGFloat)opacity radius:(CGFloat)radius offset:(CGSize)offset;

//修改方法名image为toImage避免在swift工程中和UIImageView的image冲突导致无法编译
- (UIImage *)toImage;

- (UIImage *)toImageWithScale:(float)scale;

- (NSString *)levelWithIndent:(NSString *)indent;

- (nullable __kindof UILabel *)labelWithTag:(NSInteger)tag;
- (nullable __kindof UIImageView *)imageViewWithTag:(NSInteger)tag;
- (nullable __kindof UITextField *)textFieldWithTag:(NSInteger)tag;
- (nullable __kindof UITextView *)textViewWithTag:(NSInteger)tag;
- (nullable __kindof UIButton *)buttonWithTag:(NSInteger)tag;
- (nullable __kindof UIView *)view4Class:(Class)cls withTag:(NSInteger)tag;

+ (nullable __kindof UIView *)initByNibName:(NSString *)name;
+ (nullable __kindof UIView *)initByNibName:(NSString *)name index:(NSInteger)index;

@end

@interface UIView (Inspectable)

@property (nonatomic, assign) IBInspectable CGFloat cornerRadius;
@property (nonatomic, assign) IBInspectable CGFloat borderWidth;
@property (nonatomic, copy) IBInspectable UIColor * borderColor;

@end

NS_ASSUME_NONNULL_END
